[gcode_macro BEGIN_LAYER]
description: Start a new layer and notify system
gcode:

  {% set CUR  = params.NUM|default(0)|float + 1 %}
  {% if params.COUNT and params.COUNT != 0 %}
        {% set TOTAL = params.COUNT|default(0)|float %}
  {% elif printer["gcode_macro middle"].total_layer and printer["gcode_macro middle"].total_layer!= 0 %}
        {% set TOTAL = printer["gcode_macro middle"].total_layer %}
  {% else %}
         { action_respond_info("COUNT of Total layers is required!") }
  {% endif %}

  SET_GCODE_VARIABLE MACRO=middle VARIABLE=cur_layer VALUE={CUR}
  SET_GCODE_VARIABLE MACRO=middle VARIABLE=total_layer VALUE={TOTAL}
 # {action_respond_info("BEGIN CUR: %s TOTAL: %s" % (CUR, TOTAL))}


[gcode_macro middle]
description: Variable_storage
variable_cur_layer: 0
variable_total_layer: 0
gcode:
#    {action_respond_info("MIDDLE TOTAL: %s TOTAL: %s" % (CURRENT_LAYER, TOTAL_LAYER))}

[gcode_macro MATRIX]
gcode:
    {% set CURRENT_LAYER = printer["gcode_macro middle"].cur_layer %}
    {% set TOTAL_LAYER = printer["gcode_macro middle"].total_layer %}

    {% set angle_move = 180 / TOTAL_LAYER * CURRENT_LAYER %} #задаем переменную сдвига на слой. вот здесь и задаем свою серву 180 или 270 градусов.
#    { action_respond_info("MATIRIX TOTAL: %s CUR: %s" % (TOTAL_LAYER, CURRENT_LAYER)) } #вывод в консоль текущего слоя и всего слоев
    { action_respond_info("angle %s" % angle_move) } # вывод в консоль текущего угла
#    SET_SERVO SERVO=matrix ANGLE={angle_move} #4 макрос сдвига

; -----------------------------------------------------------------------    
; что вписать в куру в разделе постобработки пункт "найти и заменить" копировать текст внутри скобок()
;(;LAYER_COUNT:(\d.*)\n)
; на что меням
;(;LAYER_COUNT:\1\nBEGIN_LAYER COUNT=\1\n)

; -----------------

;еще раз "найти и заменить" 
;(;LAYER:(\d.*);\n)
; на это
;(;LAYER:\1;\nBEGIN_LAYER NUM=\1\nMATRIX\n)
;-------------------------------------------------------------------------
[gcode_macro move_cam]
gcode:
  {% set T = params.T|default(0) %}
  SET_SERVO SERVO=matrix ANGLE={T}




#[led_effect panel_idle]
#autostart:              true
#frame_rate:             24
#leds:
#    neopixel:my_neopixel (1,5,15,20,27)
#layers:
#   breathing  10 1 top (.5,.5,0), (0.5,.5,0), (0.5,.2,0), (.1,.1,0)
#       static  1 0 bottom (.25,.25,0), (0.25,.1,0), (0.25,.1,0), (.1,.1,0)
#
#[led_effect Heater]
#leds:
#    neopixel:printhead (2)
#autostart:                          true
#frame_rate:                         24
#heater:                             extruder
#layers:
#    heater  60 1 add    (0,2,0.2,0), (0,0.5,0)
#    static  0  1 divide    (0.5,0,0)

[delayed_gcode welcome]
initial_duration: 5.
gcode:
    QUERY_BME280
    PartyTime
    
[gcode_macro beep]
gcode:
  SET_PIN PIN=_Zummer VALUE=1
  G4 P5000
  SET_PIN PIN=_Zummer VALUE=0



[gcode_macro PartyTime]
gcode:
    {% for flashes in range(params.COUNT|default(10)|int) %}
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=12 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=13 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=14 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=15 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=16 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=17 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=18 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=19 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=20 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=21 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=22 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=23 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=24 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=25 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=26 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=27 TRANSMIT=1
	G4 P250                       ; sleep 250ms
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=12 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=13 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=14 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=15 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=16 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=17 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=18 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=19 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=20 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=21 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=22 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=23 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=24 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=25 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=26 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=27 TRANSMIT=1
      
	G4 P250                       ; sleep 250ms
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=13 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=14 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=15 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=16 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=17 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=18 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=19 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=20 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=21 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=22 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=23 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=24 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=25 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=26 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=27 TRANSMIT=1

	G4 P250                       ; sleep 250ms
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=13 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=14 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.5 BLUE=0.0 INDEX=15 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=16 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=17 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=18 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=19 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=20 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=21 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=22 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=23 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.5 GREEN=0.0 BLUE=0.0 INDEX=24 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=25 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=26 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.5 INDEX=27 TRANSMIT=1

	G4 P250                       ; sleep 250ms
    {% endfor %}
    SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3



[gcode_macro POLICE_Time]
gcode:
    {% for flashes in range(params.COUNT|default(30)|int) %}
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1
    
        G4 P150                       ; sleep 150ms   
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1
    
        G4 P150                       ; sleep 150ms   
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1
    
        G4 P150                       ; sleep 150ms  
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms   
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=1.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms  
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms  
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms  
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms  
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms  
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=1 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=2 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=3 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=4 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=0.0 INDEX=5 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=6 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.3 GREEN=0.3 BLUE=0.3 INDEX=7 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=8 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=9 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=10 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=11 TRANSMIT=0
        SET_LED LED=my_neopixel RED=0.0 GREEN=0.0 BLUE=1.0 INDEX=12 TRANSMIT=1

        G4 P150                       ; sleep 150ms
     {% endfor %} 
       SET_LED LED=my_neopixel RED=0.5 GREEN=0.5 BLUE=0.5




#[gcode_macro _set_leds]
#gcode:
#    {% if printer.extruder.target == 0 %} 
#        # the extrude heater is off 
#    {% else %}
#        # the extrude heater is on
#        {% if printer.idle_timeout.state == "Printing" %}
#            # we are printing 
#            # progress is in the display_status object 
#            {% set perc = printer.display_status.progress %} 
#            # set this to how many leds you have for your bar 
#            {% set numleds = 27 %}
#            {% set last = (perc|float * numleds|float)|int %}
#            {% for n in range(numleds) %} 
#                {% if n < last %} 
#                    SET_LED LED=my_neopixel RED=0 GREEN=0.25 BLUE=0.0 TRANSMIT=0 index={ n + 1|int }
#                {% else %} 
#                    SET_LED LED=my_neopixel RED=0.25 GREEN=0.25 BLUE=0.25 TRANSMIT=0 index={ n + 1|int }
#                {% endif %}
#            {% endfor %}
#            # now actually transmit it
#            SET_LED LED=my_neopixel RED=0.25 GREEN=0 BLUE=0 TRANSMIT=1 INDEX={ last + 1|int }
#        {% endif %}
#    {% endif %}
#    
#[delayed_gcode _update_leds_loop]
#initial_duration: 5 
#gcode:
#    _set_leds 
#    UPDATE_DELAYED_GCODE ID=_update_leds_loop DURATION=60
